#-
# ==========================================================================
# Copyright (C) 1995 - 2006 Autodesk, Inc. and/or its licensors.  All 
# rights reserved.
#
# The coded instructions, statements, computer programs, and/or related 
# material (collectively the "Data") in these files contain unpublished 
# information proprietary to Autodesk, Inc. ("Autodesk") and/or its 
# licensors, which is protected by U.S. and Canadian federal copyright 
# law and by international treaties.
#
# The Data is provided for use exclusively by You. You have the right 
# to use, modify, and incorporate this Data into other products for 
# purposes authorized by the Autodesk software license agreement, 
# without fee.
#
# The copyright notices in the Software and this entire statement, 
# including the above license grant, this restriction and the 
# following disclaimer, must be included in all copies of the 
# Software, in whole or in part, and all derivative works of 
# the Software, unless such copies or derivative works are solely 
# in the form of machine-executable object code generated by a 
# source language processor.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 
# AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED 
# WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF 
# NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
# PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE, OR 
# TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS LICENSORS 
# BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL, 
# DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK 
# AND/OR ITS LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY 
# OR PROBABILITY OF SUCH DAMAGES.
#
# ==========================================================================
#+

#
#  Autodesk Script File
#  MODIFY THIS AT YOUR OWN RISK
#
#  Creation Date:   23 November 2006
#
#  Description:
#     This script creates a new spSimpleEmitter node and animates
#     it to move and spin
#
#  Procedures:
#     simpleEmitter
#

import maya.cmds as cmds

def simpleEmitter():
    cmds.file (force=True, newFile=True)
    cmds.currentUnit (linear='centimeter', angle='degree', time='film')

    # Load the plug-in emitter and create an emitter node
    cmds.loadPlugin ('simpleEmitter.py')
    cmds.createNode ('spSimpleEmitter', name='simpleEmitter')

    # Create particle object and connect to the plugin emitter node
    cmds.particle (name='particles')
    cmds.connectDynamic ('particles', em='simpleEmitter')

    cmds.setAttr ('simpleEmitter.rate', 200 )
    cmds.setAttr ('simpleEmitter.speed', 25 )

    cmds.playbackOptions (minTime=0.00, maxTime=60.0)
    cmds.currentTime (0)
    cmds.play (wait=True, forward=True)

    # make some keyframes on emitter
    cmds.currentTime (0)
    cmds.select ('simpleEmitter', replace=True)
    cmds.setKeyframe ('simpleEmitter.tx')
    cmds.setKeyframe ('simpleEmitter.ty')
    cmds.setKeyframe ('simpleEmitter.tz')
    cmds.setKeyframe ('simpleEmitter.rx')
    cmds.setKeyframe ('simpleEmitter.ry')
    cmds.setKeyframe ('simpleEmitter.rz')
    cmds.currentTime (30)
    cmds.move (-2.011944, 6.283524, -2.668834, relative=True)
    cmds.move (0, 0, 12.97635, relative=True, localSpace=True, worldSpaceDistance=True)
    cmds.rotate (0, -75.139762, 0, relative=True, objectSpace=True)
    cmds.setKeyframe ('simpleEmitter.tx')
    cmds.setKeyframe ('simpleEmitter.ty')
    cmds.setKeyframe ('simpleEmitter.tz')
    cmds.setKeyframe ('simpleEmitter.rx')
    cmds.setKeyframe ('simpleEmitter.ry')
    cmds.setKeyframe ('simpleEmitter.rz')
    cmds.currentTime (60)
    cmds.move (0, 0, -14.526107, relative=True)
    cmds.move (0, -8.130523, 0, relative=True)
    cmds.rotate (0, 0, 78.039751, relative=True, objectSpace=True)
    cmds.rotate (0, 0, 53.86918, relative=True, objectSpace=True)
    cmds.setKeyframe ('simpleEmitter.tx')
    cmds.setKeyframe ('simpleEmitter.ty')
    cmds.setKeyframe ('simpleEmitter.tz')
    cmds.setKeyframe ('simpleEmitter.rx')
    cmds.setKeyframe ('simpleEmitter.ry')
    cmds.setKeyframe ('simpleEmitter.rz')

    cmds.playbackOptions (minTime=0.00, maxTime=60.0)
    cmds.currentTime (0)
    cmds.play (wait=True, forward=True)

simpleEmitter()